import requests
import json
import codecs

url = "https://mooc.icve.com.cn/study/learn/statStuProcessCellLogAndTimeLong"

headers = {"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
           "Cookie": "acw_tc=76b20ff015741362201748091e4069ef72fc8951e43058c65b4f53966b7853; _bl_uid=q8kI33Cy53qc7021UaOwn3Lj61gU; token=anmvaaur0zdpk3kal8rovq; ASP.NET_SessionId=pkvrpd0ml13ldkav3mnt2k01; auth=01029D5A285D6A6DD708FE9DC2ECBE726DD70800166C006C0065006A00610068006300710078003700680067006700640072006F00610067006C006B003900770000012F00FFDDCFFAB80591558D57C724E6D91DFDF62C825C44; token=emgaaurjqfesy66tb0wg; verifycode=B16A76EA01ED1D9385ECAF437838702D@637098463896570361"}

var = []
f = codecs.open("数据集.txt", 'r', 'utf-8', buffering=True)
# 使用for循环遍历文件对象
for line in f:
    repr(line)
    line = line.replace('\n', '')
    line = line.replace('\r', '')
    var.append(line)
f.close()

for i in var:
    body = {
        "courseOpenId": "l58sad2pv5xffkpn4iu9fw",
        "moduleId": "g24anpe5pjq5kul75jaq",
        "cellId": i,
        "auvideoLength": "622",
        "videoTimeTotalLong": "622",
        "sourceForm": "993"
    }

    requests.packages.urllib3.disable_warnings()

    response = requests.post(url, body, headers=headers, verify=False)

    print(response.text)
